#!/usr/bin/env python3

import sys
sys.path.append('../../../tools')
from gmcore_plot import *

parser = argparse.ArgumentParser(description='Plot test results')
parser.add_argument('-o', '--output', help='Output figure')
args = parser.parse_args()

fig = plt.figure(figsize=(10, 5))
proj = ccrs.PlateCarree(central_longitude=180)

levels = np.linspace(0.1, 1.0, 21)

def plot(data_path, fig):
  f = addfile(data_path)

  ax = fig.add_subplot(121, projection=proj)
  q = f.q2[ 6,0,:,:]
  plot_contour_map(ax, q, cmap='rainbow', levels=levels, left_string=f'min: {q.min().values:.4f}, max: {q.max().values:.4f}', with_contour=False)

  ax = fig.add_subplot(122, projection=proj)
  q = f.q2[12,0,:,:]
  plot_contour_map(ax, q, cmap='rainbow', levels=levels, left_string=f'min: {q.min().values:.4f}, max: {q.max().values:.4f}', with_contour=False)

plot('adv_dc1.360x180.h0.nc', fig)
if args.output:
  plt.savefig(args.output, dpi=300)
else:
  plt.tight_layout()
  plt.show()
